package net.rvb1.gwt.grad.ui.client.menu;

import net.rvb1.gwt.grad.ui.client.menu.events.BeforeShowContextMenuEvent;

import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;

public interface HasContextMenuHandlers extends HasHandlers {
  /**
   * Adds a {@link BeforeShowContextMenuEvent.Handler} handler.
   * 
   * @param handler the context menu handler
   * @return {@link HandlerRegistration} used to remove this handler
   */
  HandlerRegistration addBeforeShowContextMenuHandler(BeforeShowContextMenuEvent.Handler handler);

  /**
   * Defines the context menu to use in this widget.
   * <p>
   * If the user selects text inside this widget and right-clicks on his selection (to copy text for
   * example) then the context menu is not shown.
   * </p>
   * 
   * @param menu the new context menu
   */
  void setContextMenu(ContextMenu menu);
}